/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helperClasses;

import com.sun.opengl.util.*;
import graphicslib3D.*;
import java.util.Vector;
import javax.media.opengl.*;
import javax.media.opengl.GLAutoDrawable;

/**
 * Creates a Teapot
 * @author Matthew
 */
public class Teapot extends Shape3D
{
    private boolean isWire = true;
    private float scale = 10f;
    private GLUT glut;

    /**
     * Constructs a Teapot
     */
    public Teapot()
    {
        glut = new GLUT();
        //this.translate(0, 0, -15);
        
    }
    
    /**
     * returns the scale
     * @return
     */
    public float getScale()
    {
        return scale;
    }
    
    /**
     * Sets the scale
     * @param s
     */
    public void setScale(float s)
    {
        scale = s;
    }
    
    /**
     * Returns whether or not the teapot is drawn in wireframe
     * @return
     */
    public boolean isWireframe()
    {
        return isWire;
    }
    
    /**
     * Sets whether or not the Teapot is drawn in wireframe
     * @param b
     */
    public void setWireframe(boolean b)
    {
        isWire = b;
    }
    
    /**
     * getPolygons - not implemented
     * @param arg0
     * @return
     */
    @Override
    public
    Vector getPolygons(Matrix3D arg0)
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    /**
     * Draws the Teapot
     * @param arg0
     */
    @Override
    public
    void draw(GLAutoDrawable arg0)
    {
        GL gl = arg0.getGL();
        gl.glMatrixMode(gl.GL_MODELVIEW);
        gl.glPushMatrix();
        
        gl.glColor3d(1,0,0);
        
        //concatentate this shape's transform onto MV
        gl.glMultMatrixd(this.getTransform().getValues(), 0);
        
        if (isWire)
        {
            glut.glutWireTeapot(scale);
        }
        else 
        {
            glut.glutSolidTeapot(scale);
        }
        
        gl.glPopMatrix();
    }
    
}
